package org.hamster.multidropbox.mainView.view
{
	import mx.events.MenuEvent;
	
	import org.hamster.common.puremvc.mediator.BaseMediator;
	
	public class AppMenuBarMediator extends BaseMediator
	{
		public static const NAME:String = "org.hamster.multidropbox.mainView.view.AppMenuBarMediator";
		
		public function AppMenuBarMediator(viewComponent:Object=null)
		{
			super(NAME, viewComponent);
		}
		
		override public function onRegister():void
		{
			app.addEventListener(MenuEvent.ITEM_CLICK, menuItemClickHandler);
		}
		
		override public function onRemove():void
		{
			
		}
		
		private function menuItemClickHandler(event:MenuEvent):void
		{
			var currentItem:Object = event.item;
			this.sendNotification(currentItem.@data);
		}
		
		public function get app():AppMenuBar
		{
			return viewComponent as AppMenuBar;
		}
	}
}